<script setup>
import { computed, ref, reactive } from "vue";
const list = reactive([1, 2, 3, 4, 5, 6, 7, 8]);
//computed函数返回的就是一个计算属性的值
const computedState = computed(() => {
  return list.filter((item) => item > 2);
});
//三秒之后，向list中添加一个元素
setTimeout(() => {
  list.push(9);
}, 3000);
</script>
<template>
  <div>
    <ul>
        <li v-for="item in computedState" :key="item">{{ item }}</li>
    </ul>
  </div>
</template>

<style scoped>
</style>
